hackerrank day 0 weighted mean solution in python